home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue43 / clinic / NewGridTestU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-01-06  |  1.8 KB  |  73 lines

  1. unit NewGridTestU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Db, Grids, DBGrids, DBTables, NewDBGrid, ComCtrls, NewGrid;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Table1: TTable;
  12.     DBGrid1: TNewDBGrid;
  13.     DataSource1: TDataSource;
  14.     chkIndicator: TCheckBox;
  15.     chkVertLine: TCheckBox;
  16.     procedure DBGrid1Resizing(Sender: TCustomDBGrid; Column: TColumn;
  17.       Width: Cardinal);
  18.     procedure DBGrid1Resized(Sender: TCustomDBGrid; Column: TColumn;
  19.       Width: Cardinal);
  20.     procedure chkIndicatorClick(Sender: TObject);
  21.     procedure chkVertLineClick(Sender: TObject);
  22.   private
  23.     { Private declarations }
  24.   public
  25.     { Public declarations }
  26.   end;
  27.  
  28. var
  29.   Form1: TForm1;
  30.  
  31. implementation
  32.  
  33. {$R *.DFM}
  34.  
  35.  
  36. procedure TForm1.DBGrid1Resizing(Sender: TCustomDBGrid; Column: TColumn;
  37.   Width: Cardinal);
  38. begin
  39.   if Assigned(Column) then
  40.     Caption := Format(
  41.       'Field %s is being resized to %d pixels',
  42.       [Column.FieldName, Width])
  43. end;
  44.  
  45. procedure TForm1.DBGrid1Resized(Sender: TCustomDBGrid; Column: TColumn;
  46.   Width: Cardinal);
  47. begin
  48.   if Assigned(Column) then
  49.     Caption := Format(
  50.       'Field %s has been resized to %d pixels',
  51.       [Column.FieldName, Width]);
  52.   //Give clear indication that the resize has finished
  53.   Color := Random($1000000)
  54. end;
  55.  
  56. procedure TForm1.chkIndicatorClick(Sender: TObject);
  57. begin
  58.   if chkIndicator.Checked then
  59.     DBGrid1.Options := DBGrid1.Options + [dgIndicator]
  60.   else
  61.     DBGrid1.Options := DBGrid1.Options - [dgIndicator]
  62. end;
  63.  
  64. procedure TForm1.chkVertLineClick(Sender: TObject);
  65. begin
  66.   if chkVertLine.Checked then
  67.     DBGrid1.Options := DBGrid1.Options + [dgColLines]
  68.   else
  69.     DBGrid1.Options := DBGrid1.Options - [dgColLines]
  70. end;
  71.  
  72. end.
  73.